package com.app.adapter;

import android.app.Activity;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;

public class ADScenicScheduledActivity  extends ADBaseAdpter{

	public ADScenicScheduledActivity(Activity activity) {
		super(activity);
//		items.add(ADScheduleAdpterItem.item("出游城市","丽江"));
//		items.add(ADScheduleAdpterItem.item("景区主题","不限"));
//		items.add(ADScheduleAdpterItem.item("景区名称","请输入景区名称",ADScheduleAdpterItem.ITEM_INPUT));
//		
		// TODO Auto-generated constructor stub
	}

	@Override
	public int getCount() {
		return items.size()+1;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int i, View convertView, ViewGroup parent) {
		
		if (i == items.size()) {
			FrameLayout layout = new FrameLayout(activity.getApplicationContext());
			Button btn = new Button(activity.getApplicationContext());
			btn.setText("搜索");
			FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
			           LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
			//此处相当于布局文件中的Android:layout_gravity属性    
			lp.gravity = Gravity.RIGHT;
			btn.setLayoutParams(lp);
			layout.addView(btn, lp);
			return layout;
		}
		ADScheduleAdpterItem item = items.get(i);
		
		return viewWithItem(item);
	}

}
